package com.shanghai.shanghaielectric;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import com.shanghai.shanghaielectric.MainActivity;

import shanghaielectric_lib.Utils.LogUtil;

/**
 * Created by 45000460 on 2017/12/13.
 */

public class BootRroadcastReceiver extends BroadcastReceiver{
    static final String ACTION="android.intent.action.BOOT_COMPLETED";
    @Override
    public void onReceive(Context context, Intent intent) {
//        Toast.makeText(context,"收到开机广播",Toast.LENGTH_SHORT).show();
        LogUtil.e("boot","收到开机广播");
        if(ACTION.equals(intent.getAction())) {
            Intent startMainActivity=new Intent(context, SplashActivity.class);
            startMainActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(startMainActivity);
        }
    }
}
